@extends('layouts.console_main')
@section('resources')
    @parent
    <style type="text/css">
        #container{ width:90%; height: 500px;}
        tfoot{background:lightblue;}
    </style>
    @endsection
@section('content')
<div class="right_col" role="main">
    <div class="">
        <div class="page-title">
            <div class="title_left">
                <h2>水表管理  >>  数据详情 </h2>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2><a href="/water/get?id={{$id}}">基本信息</a></h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li class="">
                                <a href="/water/get?id={{$id}}" class="" data-toggle="" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>

                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <div class="table-responsive">
                            <table id="datatable" class="table table-striped table-bordered">
                                <tr>
                                    <td>编号</td>
                                    <td>名称</td>
                                    <td>单位名称</td>
                                    <td>区域</td>
                                </tr>
                                <tr>
                                    <td>{{$watermeter_info['number']}}</td>
                                    <td>{{$watermeter_info['name']}}</td>
                                    <td>{{$watermeter_info['enterprise_name']}}</td>
                                    <td>{{$watermeter_info['area']}}</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>

            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>用水情况</h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="#">Settings 1</a>
                                    </li>
                                    <li><a href="#">Settings 2</a>
                                    </li>
                                </ul>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <div class="table-responsive">
                            <table id="datatable" class="table table-striped table-bordered">
                                <thead>
                                <tr>
                                    <th>时间</th>
                                    <th>使用量</th>
                                    <th>相比上一个数据变化量</th>
                                </tr>
                                </thead>
                                <tbody>
                                @if(count($watermeter_radix_lists)>0)
                                    <input type="hidden" name="day_radix_labels" value="{{json_encode($watermeter_radix_lists['labels'])}}" >
                                    <input type="hidden" name="day_radix_chart_data" value="{{json_encode($watermeter_radix_lists['radix_chart_data'])}}" >
                                    <?php $tmp=0;?>
                                    @foreach($watermeter_radix_lists['lists'] as $radixList)
                                        <tr>
                                            <td>{{$radixList['created_at']}}</td>
                                            <td>{{$radixList['radix']}}</td>
                                            <td><?php if($tmp == 0 ){ echo 0;} else {echo round($radixList['radix']-$tmp, 2);} $tmp=$radixList['radix']; ?></td>
                                        </tr>
                                    @endforeach
                                @else
                                    <tr><td colspan="4">无</td></tr>
                                @endif
                                </tbody>
                                <tfoot>
                                    <tr>
                                        <th>时间</th>
                                        <th>使用量</th>
                                        <th>相比上一个数据变化量</th>
                                    </tr>
                                </tfoot>
                            </table>
                        </div>

                    </div>
                </div>
            </div>

            <div class="clearfix"></div>

            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>曲线图<small>2018-03-27</small></h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="#">Settings 1</a>
                                    </li>
                                    <li><a href="#">Settings 2</a>
                                    </li>
                                </ul>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <canvas id="day_radix_line_chart"></canvas>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- /page content -->
@endsection
@section('scriptResources')
    @parent
    <script>

    </script>
@endsection

